﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TrafficSimulation
{
    public abstract class Cross
    {
        private int leftNeighbourId, rightNeighbourId, topNeighbourId, bottomNeighbourId;
        private Position crossPosition;//topleft point of the cross
        private TrafficLight trafficLightLeft, trafficLightTop;
        private List<Lane> lanes = new List<Lane>(12);

#region Properties

        protected int LeftNeighbourId
        {
            //TODO
            get { return 1; }
            set { }
        }
        protected int RightNeighbourId
        {
            //TODO
            get { return 1; }
            set { }
        }
        protected int TopNeighbourId
        {
            //TODO 
            get { return 1; }
            set { }
        }
        protected int BottomNeighbourId
        {
            //TODO
            get { return 1; }
            set { }
        }

        public Position CrossPosition{get;set;}//TODO
        public TrafficLight TrafficLightTop
        {
            //TODO
            get { return null; }
            set { }
        }

        public TrafficLight TrafficLightLeft
        {
            //TODO
            get { return null; }
            set { }
        }
#endregion
#region functions
        public void createCrossLanes(Position crossPosition)//topleft position
        {
        }

   

        public Position getNextPosition(Position car, Position destination)
        {
            //TODO
            return null;
        }

        public void ManageLights(int greenTime)
        {
            trafficLightLeft.ManageLights(greenTime);
            trafficLightTop.ManageLights(greenTime);
        }

        public void adjustCarGreenTrafficLight(int greenTime)
        {
            trafficLightLeft.adjustCarGreenTrafficLight(greenTime);
            trafficLightTop.adjustCarGreenTrafficLight(greenTime);
        }
#endregion
#region Events
    
        public delegate void greenLightStartedHandler(object sender, EventArgs e);
        public event greenLightStartedHandler greenLightStarted;

        public delegate void redLightStartedHandler(object sender, EventArgs e);
        public event redLightStartedHandler redLightStarted;

        public delegate void yellowLightStartedHandler(object sender, EventArgs e);
        public event yellowLightStartedHandler yellowLightStarted;
#endregion

        public Cell Cell
        {
            get
            {
                throw new System.NotImplementedException();
            }
            set
            {
            }
        }

    }
}
